package com.banyuan.lesson.输入输出流;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

//利用字节输出和输入流来复制一个文件；
public class FileCopy {
    public static void main(String[] args) {
        try (FileInputStream fis = new FileInputStream("aaa.txt");
             FileOutputStream fos = new FileOutputStream("aaa_copy.txt")){
            int len;
            byte[] arr = new byte[4];
            while((len = fis.read(arr)) != -1){
                fos.write(arr,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}